<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<h:title>My Bookings</h:title>
</h:head>
<h:body>
	<h:form>

		<p:menubar>
          	<p:menuitem value="Index" icon="ui-icon-refresh" url="index.xhtml" />
            
            <p:menuitem value="My Bookings!" icon="ui-icon-contact" url="userBookings.xhtml"/>  
            
            <p:menuitem value="Last Offers!" icon="ui-icon-search" url="packages.xhtml" />            
       
        <f:facet name="options">  
            <p:commandButton type="submit" ajax="false" action = "#{logoutBean.logout()}" value="Logout" icon="ui-icon-extlink" />  
        </f:facet>
       
       </p:menubar>

        </h:form>
<h:form id="form">
	<p:dataTable var="booking" value="#{userBean.bookings}" scrollable="true" scrollHeight="150" id="dataTable">  
  
        <p:column headerText="Price">  
            <h:outputText value="#{booking.packageChosen.price}" />  
        </p:column>  
  
        <p:column headerText="Excursion">  
            <h:outputText value="#{booking.packageChosen.excursion.type}" />  
        </p:column>  
  
        <p:column headerText="Residence">  
            <h:outputText value="#{booking.packageChosen.residence.city}" />  
        </p:column>  
  
        <p:column headerText="Departure data transport">  
            <h:outputText value="#{booking.packageChosen.departureTransport.departureDate}" />  
        </p:column>  
        
        <p:column headerText="Departure time transport">  
            <h:outputText value="#{booking.packageChosen.departureTransport.departureTime}" />  
        </p:column>  
        
          <p:column headerText="Return data transport">  
            <h:outputText value="#{booking.packageChosen.returnTransport.departureDate}" />  
        </p:column>  
        
        <p:column headerText="Return time transport">  
            <h:outputText value="#{booking.packageChosen.returnTransport.departureTime}" />  
        </p:column> 
        
        <p:column>  
            <p:commandButton value="Say to a friend" icon="ui-icon-plusthic"
            	update=":form:dataTable" oncomplete="PF('inviteDialog').show()" />
        </p:column> 
    </p:dataTable> 
    
    <p:dialog id="inviteDialog" header="Invite a friend" widgetVar="inviteDialog" resizable="false"  
              width="200" showEffect="clip" hideEffect="fold">  
           
           <p:editor id="editor" value="#{userBean.editor}" width="600"/>
           
           <p:commandButton id="submitButton" value="Submit" oncomplete="PF('inviteDialog').hide()"  
                        icon="ui-icon-plusthic" /> 
    </p:dialog>
</h:form>
</h:body>
</html>